<%@page import="com.javaleague.Constantes"%>
<%
    /**
     *  Document   : writeMessage
     *  Author     : TaixMiguel
     */
%>

    <style type="text/css">
        form {
            position: relative;
            margin: 3% 5% 3% 5%;
            padding: 3%;
            width:  90%;
            
            border: 5px solid #53698a;
        }
        
        input[type="search"] {
            width:  94%;
            
            margin: 0% 2.5% 0% 2.5%;            
            padding: 0.5%;
            
            color:  #98BEE3;
            border: 1px solid #53698a;
        }
        
        input[type="text"] {
            width:  94%;
            
            margin: 2% 2.5% 0% 2.5%;            
            padding: 0.5%;
            
            color:  #98BEE3;
            border: 1px solid #53698a;
        }
        
        textarea {
            width:  94%;
            
            margin: 2% 2.5% 0% 2.5%;            
            padding: 0.5%;
            resize: none;
            
            color:  #98BEE3;
            border: 1px solid #53698a;
        }
        
        input[type="submit"] {
            width:  20%;
            
            margin: 2% 40% 0% 40%;            
            padding: 0.5%;
            font-size: 100%;
            
            color:  #53698a;
            background-color: #E9EFF7;
            border: 1px solid #53698a;
            cursor: pointer;
        }
    </style>    

    <form action="<%= Constantes.Rutas.PATCH %>Mensajes" method="POST" onsubmit="return comprobarForm()">
        <input type="hidden" name="write" />
        <input type="search" placeholder="Para:" name="userLector" required autofocus />
        <input type="text" placeholder="Asunto:" name="subject" required />
        
        <textarea rows="15" placeholder="Mensaje..." name="message" required></textarea>
        <input type="submit" value="Enviar" />
    </form>
    
    <script type="text/javascript">
        function comprobarForm() {            
            if (opener != null) {
                parent.actualizarBandejaActual();
                setTimeout(cerrarVentana(), 1000);
            }
            return true;
        }
        
        function cerrarVentana() {            
            window.close();
        }
        
        function trim (myString) {
            return myString.replace(/\s+/g,'');
        }
    </script>